<?php


/**
 * Base class that represents a query for the 'users' table.
 *
 *
 *
 * @method RcpUsersQuery orderById($order = Criteria::ASC) Order by the id column
 * @method RcpUsersQuery orderByExtId($order = Criteria::ASC) Order by the ext_id column
 * @method RcpUsersQuery orderByPositionId($order = Criteria::ASC) Order by the position_id column
 * @method RcpUsersQuery orderByUnitId($order = Criteria::ASC) Order by the unit_id column
 * @method RcpUsersQuery orderByFname($order = Criteria::ASC) Order by the fname column
 * @method RcpUsersQuery orderByLname($order = Criteria::ASC) Order by the lname column
 * @method RcpUsersQuery orderByEmail($order = Criteria::ASC) Order by the email column
 * @method RcpUsersQuery orderByOptionalEmail($order = Criteria::ASC) Order by the optional_email column
 * @method RcpUsersQuery orderByPassword($order = Criteria::ASC) Order by the password column
 * @method RcpUsersQuery orderByAdLogin1($order = Criteria::ASC) Order by the ad_login_1 column
 * @method RcpUsersQuery orderByAdLogin2($order = Criteria::ASC) Order by the ad_login_2 column
 * @method RcpUsersQuery orderByAdLogin3($order = Criteria::ASC) Order by the ad_login_3 column
 * @method RcpUsersQuery orderByIsSuperior($order = Criteria::ASC) Order by the is_superior column
 * @method RcpUsersQuery orderByDeleted($order = Criteria::ASC) Order by the deleted column
 * @method RcpUsersQuery orderByActive($order = Criteria::ASC) Order by the active column
 * @method RcpUsersQuery orderByLastModified($order = Criteria::ASC) Order by the last_modified column
 * @method RcpUsersQuery orderByCreated($order = Criteria::ASC) Order by the created column
 *
 * @method RcpUsersQuery groupById() Group by the id column
 * @method RcpUsersQuery groupByExtId() Group by the ext_id column
 * @method RcpUsersQuery groupByPositionId() Group by the position_id column
 * @method RcpUsersQuery groupByUnitId() Group by the unit_id column
 * @method RcpUsersQuery groupByFname() Group by the fname column
 * @method RcpUsersQuery groupByLname() Group by the lname column
 * @method RcpUsersQuery groupByEmail() Group by the email column
 * @method RcpUsersQuery groupByOptionalEmail() Group by the optional_email column
 * @method RcpUsersQuery groupByPassword() Group by the password column
 * @method RcpUsersQuery groupByAdLogin1() Group by the ad_login_1 column
 * @method RcpUsersQuery groupByAdLogin2() Group by the ad_login_2 column
 * @method RcpUsersQuery groupByAdLogin3() Group by the ad_login_3 column
 * @method RcpUsersQuery groupByIsSuperior() Group by the is_superior column
 * @method RcpUsersQuery groupByDeleted() Group by the deleted column
 * @method RcpUsersQuery groupByActive() Group by the active column
 * @method RcpUsersQuery groupByLastModified() Group by the last_modified column
 * @method RcpUsersQuery groupByCreated() Group by the created column
 *
 * @method RcpUsersQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method RcpUsersQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method RcpUsersQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method RcpUsersQuery leftJoinUnits($relationAlias = null) Adds a LEFT JOIN clause to the query using the Units relation
 * @method RcpUsersQuery rightJoinUnits($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Units relation
 * @method RcpUsersQuery innerJoinUnits($relationAlias = null) Adds a INNER JOIN clause to the query using the Units relation
 *
 * @method RcpUsersQuery leftJoinPositions($relationAlias = null) Adds a LEFT JOIN clause to the query using the Positions relation
 * @method RcpUsersQuery rightJoinPositions($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Positions relation
 * @method RcpUsersQuery innerJoinPositions($relationAlias = null) Adds a INNER JOIN clause to the query using the Positions relation
 *
 * @method RcpUsersQuery leftJoinLecturePresences($relationAlias = null) Adds a LEFT JOIN clause to the query using the LecturePresences relation
 * @method RcpUsersQuery rightJoinLecturePresences($relationAlias = null) Adds a RIGHT JOIN clause to the query using the LecturePresences relation
 * @method RcpUsersQuery innerJoinLecturePresences($relationAlias = null) Adds a INNER JOIN clause to the query using the LecturePresences relation
 *
 * @method RcpUsersQuery leftJoinAuthHistory($relationAlias = null) Adds a LEFT JOIN clause to the query using the AuthHistory relation
 * @method RcpUsersQuery rightJoinAuthHistory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AuthHistory relation
 * @method RcpUsersQuery innerJoinAuthHistory($relationAlias = null) Adds a INNER JOIN clause to the query using the AuthHistory relation
 *
 * @method RcpUsersQuery leftJoinCalendarEvents($relationAlias = null) Adds a LEFT JOIN clause to the query using the CalendarEvents relation
 * @method RcpUsersQuery rightJoinCalendarEvents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CalendarEvents relation
 * @method RcpUsersQuery innerJoinCalendarEvents($relationAlias = null) Adds a INNER JOIN clause to the query using the CalendarEvents relation
 *
 * @method RcpUsersQuery leftJoinEventOrders($relationAlias = null) Adds a LEFT JOIN clause to the query using the EventOrders relation
 * @method RcpUsersQuery rightJoinEventOrders($relationAlias = null) Adds a RIGHT JOIN clause to the query using the EventOrders relation
 * @method RcpUsersQuery innerJoinEventOrders($relationAlias = null) Adds a INNER JOIN clause to the query using the EventOrders relation
 *
 * @method RcpUsersQuery leftJoinLectures($relationAlias = null) Adds a LEFT JOIN clause to the query using the Lectures relation
 * @method RcpUsersQuery rightJoinLectures($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Lectures relation
 * @method RcpUsersQuery innerJoinLectures($relationAlias = null) Adds a INNER JOIN clause to the query using the Lectures relation
 *
 * @method RcpUsersQuery leftJoinUserHasLecture($relationAlias = null) Adds a LEFT JOIN clause to the query using the UserHasLecture relation
 * @method RcpUsersQuery rightJoinUserHasLecture($relationAlias = null) Adds a RIGHT JOIN clause to the query using the UserHasLecture relation
 * @method RcpUsersQuery innerJoinUserHasLecture($relationAlias = null) Adds a INNER JOIN clause to the query using the UserHasLecture relation
 *
 * @method RcpUsersQuery leftJoinUserRoles($relationAlias = null) Adds a LEFT JOIN clause to the query using the UserRoles relation
 * @method RcpUsersQuery rightJoinUserRoles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the UserRoles relation
 * @method RcpUsersQuery innerJoinUserRoles($relationAlias = null) Adds a INNER JOIN clause to the query using the UserRoles relation
 *
 * @method RcpUsersQuery leftJoinSystemLogs($relationAlias = null) Adds a LEFT JOIN clause to the query using the SystemLogs relation
 * @method RcpUsersQuery rightJoinSystemLogs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SystemLogs relation
 * @method RcpUsersQuery innerJoinSystemLogs($relationAlias = null) Adds a INNER JOIN clause to the query using the SystemLogs relation
 *
 * @method RcpUsersQuery leftJoinUserCalendars($relationAlias = null) Adds a LEFT JOIN clause to the query using the UserCalendars relation
 * @method RcpUsersQuery rightJoinUserCalendars($relationAlias = null) Adds a RIGHT JOIN clause to the query using the UserCalendars relation
 * @method RcpUsersQuery innerJoinUserCalendars($relationAlias = null) Adds a INNER JOIN clause to the query using the UserCalendars relation
 *
 * @method RcpUsersQuery leftJoinViewCalendarEvents($relationAlias = null) Adds a LEFT JOIN clause to the query using the ViewCalendarEvents relation
 * @method RcpUsersQuery rightJoinViewCalendarEvents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ViewCalendarEvents relation
 * @method RcpUsersQuery innerJoinViewCalendarEvents($relationAlias = null) Adds a INNER JOIN clause to the query using the ViewCalendarEvents relation
 *
 * @method RcpUsers findOne(PropelPDO $con = null) Return the first RcpUsers matching the query
 * @method RcpUsers findOneOrCreate(PropelPDO $con = null) Return the first RcpUsers matching the query, or a new RcpUsers object populated from the query conditions when no match is found
 *
 * @method RcpUsers findOneById(int $id) Return the first RcpUsers filtered by the id column
 * @method RcpUsers findOneByExtId(string $ext_id) Return the first RcpUsers filtered by the ext_id column
 * @method RcpUsers findOneByPositionId(int $position_id) Return the first RcpUsers filtered by the position_id column
 * @method RcpUsers findOneByUnitId(int $unit_id) Return the first RcpUsers filtered by the unit_id column
 * @method RcpUsers findOneByFname(string $fname) Return the first RcpUsers filtered by the fname column
 * @method RcpUsers findOneByLname(string $lname) Return the first RcpUsers filtered by the lname column
 * @method RcpUsers findOneByEmail(string $email) Return the first RcpUsers filtered by the email column
 * @method RcpUsers findOneByOptionalEmail(string $optional_email) Return the first RcpUsers filtered by the optional_email column
 * @method RcpUsers findOneByPassword(string $password) Return the first RcpUsers filtered by the password column
 * @method RcpUsers findOneByAdLogin1(string $ad_login_1) Return the first RcpUsers filtered by the ad_login_1 column
 * @method RcpUsers findOneByAdLogin2(string $ad_login_2) Return the first RcpUsers filtered by the ad_login_2 column
 * @method RcpUsers findOneByAdLogin3(string $ad_login_3) Return the first RcpUsers filtered by the ad_login_3 column
 * @method RcpUsers findOneByIsSuperior(boolean $is_superior) Return the first RcpUsers filtered by the is_superior column
 * @method RcpUsers findOneByDeleted(string $deleted) Return the first RcpUsers filtered by the deleted column
 * @method RcpUsers findOneByActive(boolean $active) Return the first RcpUsers filtered by the active column
 * @method RcpUsers findOneByLastModified(string $last_modified) Return the first RcpUsers filtered by the last_modified column
 * @method RcpUsers findOneByCreated(string $created) Return the first RcpUsers filtered by the created column
 *
 * @method array findById(int $id) Return RcpUsers objects filtered by the id column
 * @method array findByExtId(string $ext_id) Return RcpUsers objects filtered by the ext_id column
 * @method array findByPositionId(int $position_id) Return RcpUsers objects filtered by the position_id column
 * @method array findByUnitId(int $unit_id) Return RcpUsers objects filtered by the unit_id column
 * @method array findByFname(string $fname) Return RcpUsers objects filtered by the fname column
 * @method array findByLname(string $lname) Return RcpUsers objects filtered by the lname column
 * @method array findByEmail(string $email) Return RcpUsers objects filtered by the email column
 * @method array findByOptionalEmail(string $optional_email) Return RcpUsers objects filtered by the optional_email column
 * @method array findByPassword(string $password) Return RcpUsers objects filtered by the password column
 * @method array findByAdLogin1(string $ad_login_1) Return RcpUsers objects filtered by the ad_login_1 column
 * @method array findByAdLogin2(string $ad_login_2) Return RcpUsers objects filtered by the ad_login_2 column
 * @method array findByAdLogin3(string $ad_login_3) Return RcpUsers objects filtered by the ad_login_3 column
 * @method array findByIsSuperior(boolean $is_superior) Return RcpUsers objects filtered by the is_superior column
 * @method array findByDeleted(string $deleted) Return RcpUsers objects filtered by the deleted column
 * @method array findByActive(boolean $active) Return RcpUsers objects filtered by the active column
 * @method array findByLastModified(string $last_modified) Return RcpUsers objects filtered by the last_modified column
 * @method array findByCreated(string $created) Return RcpUsers objects filtered by the created column
 *
 * @package    propel.generator.rcp.om
 */
abstract class RcpBaseUsersQuery extends ModelCriteria
{
    /**
     * Initializes internal state of RcpBaseUsersQuery object.
     *
     * @param     string $dbName The dabase name
     * @param     string $modelName The phpName of a model, e.g. 'Book'
     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     */
    public function __construct($dbName = 'vgp_rcp', $modelName = 'RcpUsers', $modelAlias = null)
    {
        parent::__construct($dbName, $modelName, $modelAlias);
    }

    /**
     * Returns a new RcpUsersQuery object.
     *
     * @param     string $modelAlias The alias of a model in the query
     * @param     RcpUsersQuery|Criteria $criteria Optional Criteria to build the query from
     *
     * @return RcpUsersQuery
     */
    public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof RcpUsersQuery) {
            return $criteria;
        }
        $query = new RcpUsersQuery();
        if (null !== $modelAlias) {
            $query->setModelAlias($modelAlias);
        }
        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }

    /**
     * Find object by primary key.
     * Propel uses the instance pool to skip the database if the object exists.
     * Go fast if the query is untouched.
     *
     * <code>
     * $obj  = $c->findPk(12, $con);
     * </code>
     *
     * @param mixed $key Primary key to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return   RcpUsers|RcpUsers[]|mixed the result, formatted by the current formatter
     */
    public function findPk($key, $con = null)
    {
        if ($key === null) {
            return null;
        }
        if ((null !== ($obj = RcpUsersPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
            // the object is alredy in the instance pool
            return $obj;
        }
        if ($con === null) {
            $con = Propel::getConnection(RcpUsersPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        if ($this->formatter || $this->modelAlias || $this->with || $this->select
         || $this->selectColumns || $this->asColumns || $this->selectModifiers
         || $this->map || $this->having || $this->joins) {
            return $this->findPkComplex($key, $con);
        } else {
            return $this->findPkSimple($key, $con);
        }
    }

    /**
     * Find object by primary key using raw SQL to go fast.
     * Bypass doSelect() and the object formatter by using generated code.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return   RcpUsers A model object, or null if the key is not found
     * @throws   PropelException
     */
    protected function findPkSimple($key, $con)
    {
        $sql = 'SELECT ID, EXT_ID, POSITION_ID, UNIT_ID, FNAME, LNAME, EMAIL, OPTIONAL_EMAIL, PASSWORD, AD_LOGIN_1, AD_LOGIN_2, AD_LOGIN_3, IS_SUPERIOR, DELETED, ACTIVE, LAST_MODIFIED, CREATED FROM users WHERE ID = :p0';
        try {
            $stmt = $con->prepare($sql);
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
        }
        $obj = null;
        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $obj = new RcpUsers();
            $obj->hydrate($row);
            RcpUsersPeer::addInstanceToPool($obj, (string) $key);
        }
        $stmt->closeCursor();

        return $obj;
    }

    /**
     * Find object by primary key.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return RcpUsers|RcpUsers[]|mixed the result, formatted by the current formatter
     */
    protected function findPkComplex($key, $con)
    {
        // As the query uses a PK condition, no limit(1) is necessary.
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKey($key)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    }

    /**
     * Find objects by primary key
     * <code>
     * $objs = $c->findPks(array(12, 56, 832), $con);
     * </code>
     * @param     array $keys Primary keys to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return PropelObjectCollection|RcpUsers[]|mixed the list of results, formatted by the current formatter
     */
    public function findPks($keys, $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKeys($keys)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->format($stmt);
    }

    /**
     * Filter the query by primary key
     *
     * @param     mixed $key Primary key to use for the query
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByPrimaryKey($key)
    {

        return $this->addUsingAlias(RcpUsersPeer::ID, $key, Criteria::EQUAL);
    }

    /**
     * Filter the query by a list of primary keys
     *
     * @param     array $keys The list of primary key to use for the query
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByPrimaryKeys($keys)
    {

        return $this->addUsingAlias(RcpUsersPeer::ID, $keys, Criteria::IN);
    }

    /**
     * Filter the query on the id column
     *
     * Example usage:
     * <code>
     * $query->filterById(1234); // WHERE id = 1234
     * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
     * $query->filterById(array('min' => 12)); // WHERE id > 12
     * </code>
     *
     * @param     mixed $id The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterById($id = null, $comparison = null)
    {
        if (is_array($id) && null === $comparison) {
            $comparison = Criteria::IN;
        }

        return $this->addUsingAlias(RcpUsersPeer::ID, $id, $comparison);
    }

    /**
     * Filter the query on the ext_id column
     *
     * Example usage:
     * <code>
     * $query->filterByExtId('fooValue');   // WHERE ext_id = 'fooValue'
     * $query->filterByExtId('%fooValue%'); // WHERE ext_id LIKE '%fooValue%'
     * </code>
     *
     * @param     string $extId The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByExtId($extId = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($extId)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $extId)) {
                $extId = str_replace('*', '%', $extId);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::EXT_ID, $extId, $comparison);
    }

    /**
     * Filter the query on the position_id column
     *
     * Example usage:
     * <code>
     * $query->filterByPositionId(1234); // WHERE position_id = 1234
     * $query->filterByPositionId(array(12, 34)); // WHERE position_id IN (12, 34)
     * $query->filterByPositionId(array('min' => 12)); // WHERE position_id > 12
     * </code>
     *
     * @see       filterByPositions()
     *
     * @param     mixed $positionId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByPositionId($positionId = null, $comparison = null)
    {
        if (is_array($positionId)) {
            $useMinMax = false;
            if (isset($positionId['min'])) {
                $this->addUsingAlias(RcpUsersPeer::POSITION_ID, $positionId['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($positionId['max'])) {
                $this->addUsingAlias(RcpUsersPeer::POSITION_ID, $positionId['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::POSITION_ID, $positionId, $comparison);
    }

    /**
     * Filter the query on the unit_id column
     *
     * Example usage:
     * <code>
     * $query->filterByUnitId(1234); // WHERE unit_id = 1234
     * $query->filterByUnitId(array(12, 34)); // WHERE unit_id IN (12, 34)
     * $query->filterByUnitId(array('min' => 12)); // WHERE unit_id > 12
     * </code>
     *
     * @see       filterByUnits()
     *
     * @param     mixed $unitId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByUnitId($unitId = null, $comparison = null)
    {
        if (is_array($unitId)) {
            $useMinMax = false;
            if (isset($unitId['min'])) {
                $this->addUsingAlias(RcpUsersPeer::UNIT_ID, $unitId['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($unitId['max'])) {
                $this->addUsingAlias(RcpUsersPeer::UNIT_ID, $unitId['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::UNIT_ID, $unitId, $comparison);
    }

    /**
     * Filter the query on the fname column
     *
     * Example usage:
     * <code>
     * $query->filterByFname('fooValue');   // WHERE fname = 'fooValue'
     * $query->filterByFname('%fooValue%'); // WHERE fname LIKE '%fooValue%'
     * </code>
     *
     * @param     string $fname The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByFname($fname = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($fname)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $fname)) {
                $fname = str_replace('*', '%', $fname);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::FNAME, $fname, $comparison);
    }

    /**
     * Filter the query on the lname column
     *
     * Example usage:
     * <code>
     * $query->filterByLname('fooValue');   // WHERE lname = 'fooValue'
     * $query->filterByLname('%fooValue%'); // WHERE lname LIKE '%fooValue%'
     * </code>
     *
     * @param     string $lname The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByLname($lname = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($lname)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $lname)) {
                $lname = str_replace('*', '%', $lname);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::LNAME, $lname, $comparison);
    }

    /**
     * Filter the query on the email column
     *
     * Example usage:
     * <code>
     * $query->filterByEmail('fooValue');   // WHERE email = 'fooValue'
     * $query->filterByEmail('%fooValue%'); // WHERE email LIKE '%fooValue%'
     * </code>
     *
     * @param     string $email The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByEmail($email = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($email)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $email)) {
                $email = str_replace('*', '%', $email);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::EMAIL, $email, $comparison);
    }

    /**
     * Filter the query on the optional_email column
     *
     * Example usage:
     * <code>
     * $query->filterByOptionalEmail('fooValue');   // WHERE optional_email = 'fooValue'
     * $query->filterByOptionalEmail('%fooValue%'); // WHERE optional_email LIKE '%fooValue%'
     * </code>
     *
     * @param     string $optionalEmail The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByOptionalEmail($optionalEmail = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($optionalEmail)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $optionalEmail)) {
                $optionalEmail = str_replace('*', '%', $optionalEmail);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::OPTIONAL_EMAIL, $optionalEmail, $comparison);
    }

    /**
     * Filter the query on the password column
     *
     * Example usage:
     * <code>
     * $query->filterByPassword('fooValue');   // WHERE password = 'fooValue'
     * $query->filterByPassword('%fooValue%'); // WHERE password LIKE '%fooValue%'
     * </code>
     *
     * @param     string $password The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByPassword($password = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($password)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $password)) {
                $password = str_replace('*', '%', $password);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::PASSWORD, $password, $comparison);
    }

    /**
     * Filter the query on the ad_login_1 column
     *
     * Example usage:
     * <code>
     * $query->filterByAdLogin1('fooValue');   // WHERE ad_login_1 = 'fooValue'
     * $query->filterByAdLogin1('%fooValue%'); // WHERE ad_login_1 LIKE '%fooValue%'
     * </code>
     *
     * @param     string $adLogin1 The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByAdLogin1($adLogin1 = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($adLogin1)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $adLogin1)) {
                $adLogin1 = str_replace('*', '%', $adLogin1);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::AD_LOGIN_1, $adLogin1, $comparison);
    }

    /**
     * Filter the query on the ad_login_2 column
     *
     * Example usage:
     * <code>
     * $query->filterByAdLogin2('fooValue');   // WHERE ad_login_2 = 'fooValue'
     * $query->filterByAdLogin2('%fooValue%'); // WHERE ad_login_2 LIKE '%fooValue%'
     * </code>
     *
     * @param     string $adLogin2 The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByAdLogin2($adLogin2 = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($adLogin2)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $adLogin2)) {
                $adLogin2 = str_replace('*', '%', $adLogin2);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::AD_LOGIN_2, $adLogin2, $comparison);
    }

    /**
     * Filter the query on the ad_login_3 column
     *
     * Example usage:
     * <code>
     * $query->filterByAdLogin3('fooValue');   // WHERE ad_login_3 = 'fooValue'
     * $query->filterByAdLogin3('%fooValue%'); // WHERE ad_login_3 LIKE '%fooValue%'
     * </code>
     *
     * @param     string $adLogin3 The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByAdLogin3($adLogin3 = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($adLogin3)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $adLogin3)) {
                $adLogin3 = str_replace('*', '%', $adLogin3);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::AD_LOGIN_3, $adLogin3, $comparison);
    }

    /**
     * Filter the query on the is_superior column
     *
     * Example usage:
     * <code>
     * $query->filterByIsSuperior(true); // WHERE is_superior = true
     * $query->filterByIsSuperior('yes'); // WHERE is_superior = true
     * </code>
     *
     * @param     boolean|string $isSuperior The value to use as filter.
     *              Non-boolean arguments are converted using the following rules:
     *                * 1, '1', 'true',  'on',  and 'yes' are converted to boolean true
     *                * 0, '0', 'false', 'off', and 'no'  are converted to boolean false
     *              Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByIsSuperior($isSuperior = null, $comparison = null)
    {
        if (is_string($isSuperior)) {
            $is_superior = in_array(strtolower($isSuperior), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
        }

        return $this->addUsingAlias(RcpUsersPeer::IS_SUPERIOR, $isSuperior, $comparison);
    }

    /**
     * Filter the query on the deleted column
     *
     * Example usage:
     * <code>
     * $query->filterByDeleted('2011-03-14'); // WHERE deleted = '2011-03-14'
     * $query->filterByDeleted('now'); // WHERE deleted = '2011-03-14'
     * $query->filterByDeleted(array('max' => 'yesterday')); // WHERE deleted > '2011-03-13'
     * </code>
     *
     * @param     mixed $deleted The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByDeleted($deleted = null, $comparison = null)
    {
        if (is_array($deleted)) {
            $useMinMax = false;
            if (isset($deleted['min'])) {
                $this->addUsingAlias(RcpUsersPeer::DELETED, $deleted['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($deleted['max'])) {
                $this->addUsingAlias(RcpUsersPeer::DELETED, $deleted['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::DELETED, $deleted, $comparison);
    }

    /**
     * Filter the query on the active column
     *
     * Example usage:
     * <code>
     * $query->filterByActive(true); // WHERE active = true
     * $query->filterByActive('yes'); // WHERE active = true
     * </code>
     *
     * @param     boolean|string $active The value to use as filter.
     *              Non-boolean arguments are converted using the following rules:
     *                * 1, '1', 'true',  'on',  and 'yes' are converted to boolean true
     *                * 0, '0', 'false', 'off', and 'no'  are converted to boolean false
     *              Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByActive($active = null, $comparison = null)
    {
        if (is_string($active)) {
            $active = in_array(strtolower($active), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
        }

        return $this->addUsingAlias(RcpUsersPeer::ACTIVE, $active, $comparison);
    }

    /**
     * Filter the query on the last_modified column
     *
     * Example usage:
     * <code>
     * $query->filterByLastModified('2011-03-14'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified('now'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified(array('max' => 'yesterday')); // WHERE last_modified > '2011-03-13'
     * </code>
     *
     * @param     mixed $lastModified The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByLastModified($lastModified = null, $comparison = null)
    {
        if (is_array($lastModified)) {
            $useMinMax = false;
            if (isset($lastModified['min'])) {
                $this->addUsingAlias(RcpUsersPeer::LAST_MODIFIED, $lastModified['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($lastModified['max'])) {
                $this->addUsingAlias(RcpUsersPeer::LAST_MODIFIED, $lastModified['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::LAST_MODIFIED, $lastModified, $comparison);
    }

    /**
     * Filter the query on the created column
     *
     * Example usage:
     * <code>
     * $query->filterByCreated('2011-03-14'); // WHERE created = '2011-03-14'
     * $query->filterByCreated('now'); // WHERE created = '2011-03-14'
     * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13'
     * </code>
     *
     * @param     mixed $created The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function filterByCreated($created = null, $comparison = null)
    {
        if (is_array($created)) {
            $useMinMax = false;
            if (isset($created['min'])) {
                $this->addUsingAlias(RcpUsersPeer::CREATED, $created['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($created['max'])) {
                $this->addUsingAlias(RcpUsersPeer::CREATED, $created['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(RcpUsersPeer::CREATED, $created, $comparison);
    }

    /**
     * Filter the query by a related RcpUnits object
     *
     * @param   RcpUnits|PropelObjectCollection $units The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByUnits($units, $comparison = null)
    {
        if ($units instanceof RcpUnits) {
            return $this
                ->addUsingAlias(RcpUsersPeer::UNIT_ID, $units->getId(), $comparison);
        } elseif ($units instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(RcpUsersPeer::UNIT_ID, $units->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByUnits() only accepts arguments of type RcpUnits or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the Units relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinUnits($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('Units');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'Units');
        }

        return $this;
    }

    /**
     * Use the Units relation Units object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpUnitsQuery A secondary query class using the current class as primary query
     */
    public function useUnitsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinUnits($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'Units', 'RcpUnitsQuery');
    }

    /**
     * Filter the query by a related RcpPositions object
     *
     * @param   RcpPositions|PropelObjectCollection $positions The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByPositions($positions, $comparison = null)
    {
        if ($positions instanceof RcpPositions) {
            return $this
                ->addUsingAlias(RcpUsersPeer::POSITION_ID, $positions->getId(), $comparison);
        } elseif ($positions instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(RcpUsersPeer::POSITION_ID, $positions->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByPositions() only accepts arguments of type RcpPositions or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the Positions relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinPositions($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('Positions');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'Positions');
        }

        return $this;
    }

    /**
     * Use the Positions relation Positions object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpPositionsQuery A secondary query class using the current class as primary query
     */
    public function usePositionsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinPositions($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'Positions', 'RcpPositionsQuery');
    }

    /**
     * Filter the query by a related RcpLecturePresences object
     *
     * @param   RcpLecturePresences|PropelObjectCollection $lecturePresences  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByLecturePresences($lecturePresences, $comparison = null)
    {
        if ($lecturePresences instanceof RcpLecturePresences) {
            return $this
                ->addUsingAlias(RcpUsersPeer::ID, $lecturePresences->getUserId(), $comparison);
        } elseif ($lecturePresences instanceof PropelObjectCollection) {
            return $this
                ->useLecturePresencesQuery()
                ->filterByPrimaryKeys($lecturePresences->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByLecturePresences() only accepts arguments of type RcpLecturePresences or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the LecturePresences relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinLecturePresences($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('LecturePresences');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'LecturePresences');
        }

        return $this;
    }

    /**
     * Use the LecturePresences relation LecturePresences object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpLecturePresencesQuery A secondary query class using the current class as primary query
     */
    public function useLecturePresencesQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinLecturePresences($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'LecturePresences', 'RcpLecturePresencesQuery');
    }

    /**
     * Filter the query by a related RcpAuthHistory object
     *
     * @param   RcpAuthHistory|PropelObjectCollection $authHistory  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByAuthHistory($authHistory, $comparison = null)
    {
        if ($authHistory instanceof RcpAuthHistory) {
            return $this
                ->addUsingAlias(RcpUsersPeer::ID, $authHistory->getUserId(), $comparison);
        } elseif ($authHistory instanceof PropelObjectCollection) {
            return $this
                ->useAuthHistoryQuery()
                ->filterByPrimaryKeys($authHistory->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByAuthHistory() only accepts arguments of type RcpAuthHistory or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the AuthHistory relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinAuthHistory($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('AuthHistory');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'AuthHistory');
        }

        return $this;
    }

    /**
     * Use the AuthHistory relation AuthHistory object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpAuthHistoryQuery A secondary query class using the current class as primary query
     */
    public function useAuthHistoryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    {
        return $this
            ->joinAuthHistory($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'AuthHistory', 'RcpAuthHistoryQuery');
    }

    /**
     * Filter the query by a related RcpCalendarEvents object
     *
     * @param   RcpCalendarEvents|PropelObjectCollection $calendarEvents  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByCalendarEvents($calendarEvents, $comparison = null)
    {
        if ($calendarEvents instanceof RcpCalendarEvents) {
            return $this
                ->addUsingAlias(RcpUsersPeer::ID, $calendarEvents->getUserId(), $comparison);
        } elseif ($calendarEvents instanceof PropelObjectCollection) {
            return $this
                ->useCalendarEventsQuery()
                ->filterByPrimaryKeys($calendarEvents->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByCalendarEvents() only accepts arguments of type RcpCalendarEvents or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the CalendarEvents relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinCalendarEvents($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('CalendarEvents');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'CalendarEvents');
        }

        return $this;
    }

    /**
     * Use the CalendarEvents relation CalendarEvents object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpCalendarEventsQuery A secondary query class using the current class as primary query
     */
    public function useCalendarEventsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinCalendarEvents($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'CalendarEvents', 'RcpCalendarEventsQuery');
    }

    /**
     * Filter the query by a related RcpEventOrders object
     *
     * @param   RcpEventOrders|PropelObjectCollection $eventOrders  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByEventOrders($eventOrders, $comparison = null)
    {
        if ($eventOrders instanceof RcpEventOrders) {
            return $this
                ->addUsingAlias(RcpUsersPeer::ID, $eventOrders->getUserId(), $comparison);
        } elseif ($eventOrders instanceof PropelObjectCollection) {
            return $this
                ->useEventOrdersQuery()
                ->filterByPrimaryKeys($eventOrders->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByEventOrders() only accepts arguments of type RcpEventOrders or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the EventOrders relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinEventOrders($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('EventOrders');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'EventOrders');
        }

        return $this;
    }

    /**
     * Use the EventOrders relation EventOrders object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpEventOrdersQuery A secondary query class using the current class as primary query
     */
    public function useEventOrdersQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    {
        return $this
            ->joinEventOrders($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'EventOrders', 'RcpEventOrdersQuery');
    }

    /**
     * Filter the query by a related RcpLectures object
     *
     * @param   RcpLectures|PropelObjectCollection $lectures  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByLectures($lectures, $comparison = null)
    {
        if ($lectures instanceof RcpLectures) {
            return $this
                ->addUsingAlias(RcpUsersPeer::ID, $lectures->getTeacherId(), $comparison);
        } elseif ($lectures instanceof PropelObjectCollection) {
            return $this
                ->useLecturesQuery()
                ->filterByPrimaryKeys($lectures->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByLectures() only accepts arguments of type RcpLectures or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the Lectures relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinLectures($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('Lectures');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'Lectures');
        }

        return $this;
    }

    /**
     * Use the Lectures relation Lectures object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpLecturesQuery A secondary query class using the current class as primary query
     */
    public function useLecturesQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinLectures($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'Lectures', 'RcpLecturesQuery');
    }

    /**
     * Filter the query by a related RcpUserHasLecture object
     *
     * @param   RcpUserHasLecture|PropelObjectCollection $userHasLecture  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByUserHasLecture($userHasLecture, $comparison = null)
    {
        if ($userHasLecture instanceof RcpUserHasLecture) {
            return $this
                ->addUsingAlias(RcpUsersPeer::ID, $userHasLecture->getUserId(), $comparison);
        } elseif ($userHasLecture instanceof PropelObjectCollection) {
            return $this
                ->useUserHasLectureQuery()
                ->filterByPrimaryKeys($userHasLecture->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByUserHasLecture() only accepts arguments of type RcpUserHasLecture or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the UserHasLecture relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinUserHasLecture($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('UserHasLecture');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'UserHasLecture');
        }

        return $this;
    }

    /**
     * Use the UserHasLecture relation UserHasLecture object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpUserHasLectureQuery A secondary query class using the current class as primary query
     */
    public function useUserHasLectureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinUserHasLecture($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'UserHasLecture', 'RcpUserHasLectureQuery');
    }

    /**
     * Filter the query by a related RcpUserRoles object
     *
     * @param   RcpUserRoles|PropelObjectCollection $userRoles  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByUserRoles($userRoles, $comparison = null)
    {
        if ($userRoles instanceof RcpUserRoles) {
            return $this
                ->addUsingAlias(RcpUsersPeer::ID, $userRoles->getUserId(), $comparison);
        } elseif ($userRoles instanceof PropelObjectCollection) {
            return $this
                ->useUserRolesQuery()
                ->filterByPrimaryKeys($userRoles->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByUserRoles() only accepts arguments of type RcpUserRoles or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the UserRoles relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinUserRoles($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('UserRoles');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'UserRoles');
        }

        return $this;
    }

    /**
     * Use the UserRoles relation UserRoles object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpUserRolesQuery A secondary query class using the current class as primary query
     */
    public function useUserRolesQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinUserRoles($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'UserRoles', 'RcpUserRolesQuery');
    }

    /**
     * Filter the query by a related RcpSystemLogs object
     *
     * @param   RcpSystemLogs|PropelObjectCollection $systemLogs  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterBySystemLogs($systemLogs, $comparison = null)
    {
        if ($systemLogs instanceof RcpSystemLogs) {
            return $this
                ->addUsingAlias(RcpUsersPeer::ID, $systemLogs->getUserId(), $comparison);
        } elseif ($systemLogs instanceof PropelObjectCollection) {
            return $this
                ->useSystemLogsQuery()
                ->filterByPrimaryKeys($systemLogs->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterBySystemLogs() only accepts arguments of type RcpSystemLogs or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the SystemLogs relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinSystemLogs($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('SystemLogs');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'SystemLogs');
        }

        return $this;
    }

    /**
     * Use the SystemLogs relation SystemLogs object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpSystemLogsQuery A secondary query class using the current class as primary query
     */
    public function useSystemLogsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    {
        return $this
            ->joinSystemLogs($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'SystemLogs', 'RcpSystemLogsQuery');
    }

    /**
     * Filter the query by a related RcpUserCalendars object
     *
     * @param   RcpUserCalendars|PropelObjectCollection $userCalendars  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByUserCalendars($userCalendars, $comparison = null)
    {
        if ($userCalendars instanceof RcpUserCalendars) {
            return $this
                ->addUsingAlias(RcpUsersPeer::ID, $userCalendars->getUserId(), $comparison);
        } elseif ($userCalendars instanceof PropelObjectCollection) {
            return $this
                ->useUserCalendarsQuery()
                ->filterByPrimaryKeys($userCalendars->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByUserCalendars() only accepts arguments of type RcpUserCalendars or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the UserCalendars relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinUserCalendars($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('UserCalendars');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'UserCalendars');
        }

        return $this;
    }

    /**
     * Use the UserCalendars relation UserCalendars object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpUserCalendarsQuery A secondary query class using the current class as primary query
     */
    public function useUserCalendarsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinUserCalendars($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'UserCalendars', 'RcpUserCalendarsQuery');
    }

    /**
     * Filter the query by a related RcpViewCalendarEvents object
     *
     * @param   RcpViewCalendarEvents|PropelObjectCollection $viewCalendarEvents  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpUsersQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByViewCalendarEvents($viewCalendarEvents, $comparison = null)
    {
        if ($viewCalendarEvents instanceof RcpViewCalendarEvents) {
            return $this
                ->addUsingAlias(RcpUsersPeer::ID, $viewCalendarEvents->getUserId(), $comparison);
        } elseif ($viewCalendarEvents instanceof PropelObjectCollection) {
            return $this
                ->useViewCalendarEventsQuery()
                ->filterByPrimaryKeys($viewCalendarEvents->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByViewCalendarEvents() only accepts arguments of type RcpViewCalendarEvents or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the ViewCalendarEvents relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function joinViewCalendarEvents($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('ViewCalendarEvents');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'ViewCalendarEvents');
        }

        return $this;
    }

    /**
     * Use the ViewCalendarEvents relation ViewCalendarEvents object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpViewCalendarEventsQuery A secondary query class using the current class as primary query
     */
    public function useViewCalendarEventsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinViewCalendarEvents($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'ViewCalendarEvents', 'RcpViewCalendarEventsQuery');
    }

    /**
     * Exclude object from result
     *
     * @param   RcpUsers $users Object to remove from the list of results
     *
     * @return RcpUsersQuery The current query, for fluid interface
     */
    public function prune($users = null)
    {
        if ($users) {
            $this->addUsingAlias(RcpUsersPeer::ID, $users->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }

}
